﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BasicCMS.Caching
{
    /// <summary>
    /// 缓存提供者
    /// </summary>
    public interface ICacheProvider
    {
        /// <summary>
        /// 根据Key获取对象
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="key"></param>
        /// <returns></returns>
        T Get<T>(string key);

        /// <summary>
        /// 添加数据到缓存
        /// </summary>
        /// <param name="key"></param>
        /// <param name="instance"></param>
        void Insert(string key, object instance);

        /// <summary>
        /// 添加数据到缓存
        /// </summary>
        /// <param name="key"></param>
        /// <param name="instance"></param>
        /// <param name="seconds"></param>
        void Insert(string key, object instance, double seconds);

        /// <summary>
        /// 从缓存中移除
        /// </summary>
        /// <param name="key"></param>
        void Remove(string key);
    }
}
